package cn.xs.surveypark.service.impl;

import java.util.List;

import javax.annotation.Resource;

import cn.xs.surveypark.dao.BaseDao;
import cn.xs.surveypark.service.BaseService;

/**
 * 抽象的service实现，专门用于继承
 * @author Administrator
 *
 * @param <T>
 */
public abstract class BaseServiceImpl<T> implements BaseService<T> {
	
	private BaseDao<T> dao;
	
	//注入Dao
	@Resource
	public void setDao(BaseDao<T> dao) {
		this.dao = dao;
	}

	@Override
	public void saveEntity(T t) {
		// TODO Auto-generated method stub
		dao.saveEntity(t);
	}

	@Override
	public void updateEntity(T t) {
		// TODO Auto-generated method stub
		dao.updateEntity(t);
	}

	@Override
	public void saveOrUpdateEntity(T t) {
		// TODO Auto-generated method stub
		dao.saveOrUpdateEntity(t);
	}

	@Override
	public void deleteEntity(T t) {
		// TODO Auto-generated method stub
		dao.deleteEntity(t);
	}

	@Override
	public void batchEnttyByHQL(String hql, Object... objects) {
		// TODO Auto-generated method stub
		dao.batchEnttyByHQL(hql, objects);
	}

	@Override
	public T getEntity(Integer id) {
		// TODO Auto-generated method stub
		return dao.getEntity(id);
	}

	@Override
	public T loadEntity(Integer id) {
		// TODO Auto-generated method stub
		return dao.loadEntity(id);
	}

	@Override
	public List<T> findgetEntityHQL(String hql, Object... objects) {
		// TODO Auto-generated method stub
		return dao.findgetEntityHQL(hql, objects);
	}

}
